/**
 * @description 公共模块，记录公共数据相关的操作 
 * @author Haixin Wen 
 */


const state = {
	userInfo: {},
	token: ''
}

const mutations = {
	// 存用户信息
	SET_USER_INFO: (state, info) => {
		state.userInfo = info
	},
	SET_TOKEN: (state, token) => {
		state.token = token
	}
}

const actions = {
	// 存token
	setUserInfo({
		commit
	}, token) {
		commit('SET_TOKEN', token);
		uni.setStorageSync('token', token)
	},
}
export default {
	namespaced: true,
	state,
	mutations,
	actions
}